﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CROSLAND.BL.BE;
using System.Data.Common;
using System.Data;
namespace CROSLAND.DL.DALC.MSSQL
{
    public class CondicionPagoDALC : BaseDALC, ICondicionPagoDALC
    {
        
        #region ICondicionPagoDALC Members

        public List<GenericBE> listar(string pID)
        {
            List<GenericBE> entitys = new List<GenericBE>();
            DbCommand command = dbProvider.GetStoredProcCommand("ZWEB_LISTA_CONDICIONESPAGO");
            dbProvider.AddInParameter(command, "IM_ZTERM", DbType.String, pID);

            using (IDataReader dr = dbProvider.ExecuteReader(command))
            {
                while (dr.Read())
                {
                    GenericBE entity = new GenericBE();

                    entity.Codigo = dr["ZTERM"].ToString();
                    entity.Descripcion = dr["ZTERM"].ToString() + " :: " + dr["TEXT1"].ToString();

                    entitys.Add(entity);
                }
            }

            return entitys;
        }

        #endregion
    }
}
